<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>事件</title>
		<script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
	</head>
	<body>
		<div id="app">
			<p @click="show1()">
				<span @click.stop="show2()">你好</span>
			</p>
			<div>
				{{msg}}
			</div>
			<div>
				{{timer}}
			</div>
		</div>
		<script>
		var vm=new Vue({
			el:'#app',
			data:{
				msg:"",
				timer:new Date().toLocaleTimeString()
			},
			mounted:function(){ 
				// window.setInterval(function(){
				// 	console.log("time....");
				// 	this.timer=new Date().toLocaleTimeString();
				// },1000);
				this.updatTime();
			},
			methods:{
				updatTime(){
					var t=this.$data;//获得所有的data
					window.setInterval(function(){
						t.timer=new Date().toLocaleTimeString();
					},1000);
				},
				show1(){
					this.msg+="p ";
				},
				show2(){
					this.msg+="span ";
				}
			}
		})
		</script>
	</body>
</html>
